<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="<?=base_url('publics/admin');?>/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url('publics/admin');?>/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url('publics/admin');?>/lib/font-awesome/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
<link href="<?=base_url('publics/admin');?>/lib/font-awesome/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="<?=base_url('publics/admin');?>/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>管理</title>
</head>
<body>
<nav class="breadcrumb">
	<i class="iconfont">&#xf012b;</i> 首页 
	<span class="c-gray en">&gt;</span> 产品管理 
	<span class="c-gray en">&gt;</span> 产品列表
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<div class="pd-20">
 
  <div class="cl pd-5 bg-1 bk-gray mt-20">
  	<span class="l">
  	
  	    <a href="<?=base_url('manage/product/insert');?>" class=" ">&nbsp;</a>
  	</span>
  
  </div>
     <table class="table table-border table-bordered table-hover table-bg">
      <thead>
         <tr class="text-c">
          <th width="80">ID</th>
          <th width="80">产品名</th>
          <th>属性名</th>
          <th  width="80">类型</th>
          <th  width="80">排序</th>
          <th  width="80">状态</th>
        
        </tr>
      </thead>
      <tbody>
       <?php if(!empty($error)):?>
      	<tr  class="text-c">
        	<td colspan="6" ><?=$error;?></td>
        </tr>
       <?php else:?>
       <?php foreach($arr as $val):?>
      	<tr  class="text-c">
	      	<td><?=$val['attr_id'];?></td>
	      	<td><?=$val['pro_name'];?></td>
	      	<td><a href="<?=base_url('manage/value/insert');?>?pid=<?=$val['pro_id'];?>&aid=<?=$val['attr_id'];?>" title="产品属性值"><?=$val['attr_name'];?></a></td>
	      	<td>
	      		<?php if($val['attr_type'] == 'select'):?>下拉菜单
	      		<?php elseif($val['attr_type'] == 'radio'):?>单选按钮
				<?php elseif($val['attr_type'] == 'text'):?>文本框
				<?php elseif($val['attr_type'] == 'textarea'):?>文本域
				<?php elseif($val['attr_type'] == 'other'):?>其他
	      		<?php endif;?>
	      	</td>
	      	<td><?=$val['attr_sort'];?></td>
	      	<td><?php if($val['attr_status'] == 1):?>有效<?php else:?>无效<?php endif;?></td>
			<?php ?>
		</tr>
  		<?php endforeach;?>
      </tbody>
    </table>
    <div id="pageNav" class="pageNav"><?=$pager;?></div>
	<?php endif;?>
</div>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/jquery.min.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/layer1.8/layer.min.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/laypage/laypage.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/js/H-ui.js"></script>  
<script type="text/javascript" src="<?=base_url('publics/admin');?>/js/H-ui.admin.js"></script>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/js/H-ui.admin.doc.js"></script>
<script type="text/javascript">
$('.table-sort').dataTable({
	"lengthMenu":false,//显示数量选择 
	"bFilter": false,//过滤功能
	"bPaginate": false,//翻页信息
	"bInfo": false,//数量信息
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
	]
});

// 询问框
function deletedate(id){
	$.layer({
	    shade: [0],
	    area: ['auto','auto'],
	    dialog: {
	        msg: '确定要删除该产品？',
	        btns: 2,                    
	        type: 4,
	        btn: ['是','否'],
	        yes: function(){
	            $.get("product/delete?id="+id,function(res){
					if(res == 'ok'){
						layer.msg('删除成功!', 1, 1);
						location.reload();
					}else if(res == 'error_1'){
						layer.msg('参数不合理,不能删除!', 1, 3);
					}else{
						layer.msg('删除失败,请联系网站管理员!', 1, 3);
					}
				});
	        }, no: function(){}
	    }
	});
}
</script> 
</body>
</html>